import os
import socket
import sys

import django

def get_python_path():
    """
    获取python路径
    :return:
    """
    host_name = socket.gethostname()
    if host_name == "legend":
        python_path = "/home/legend/WorkSpace/python/water_applets/"
    if host_name == "ecs-364582":
        python_path = "/root/water_applets/"
    else:
        python_path = ""
    return python_path

sys.path.append(get_python_path())


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "water_applets.settings")
django.setup()
from models.models import AgentChannel



def set_agent_channel_origin_data():
    """
    设置水滴任务
    :return:
    """
    AgentChannel.objects.all().delete()
    data = [
        {
            "id": 1,
            "name": "代理商指定"
        },
        {
            "id": 2,
            "name": "直接购买"
        },
        {
            "id": 3,
            "name": "联系公司"
        },
    ]
    AgentChannel.objects.bulk_create([AgentChannel(**item) for item in data])


if __name__ == '__main__':
    set_agent_channel_origin_data()